LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file Group.php

Documentation is available at Group.php

  1. <?php require_once 'index.php'?>
  2. <h3>Group</h3>
  3. <?php
  4. // Add
  5. for ($i = 1; $i < 20; $i++{
  6.     $data = array('group_define_name' => 'GROUP'.rand());
  7.     $groupId $admin->perm->addGroup($data);
  8.  
  9.     if ($groupId === false{
  10.         echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  11.     else {
  12.         echo 'Created Group Id <b>'.$groupId.'</b><br />';
  13.     }
  14. }
  15.  
  16. // Get
  17. echo 'All the groups:<br />';
  18. $allGroups $admin->perm->getGroups();
  19.  
  20. if ($allGroups === false{
  21.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  22. else {
  23.     Var_Dump::display($allGroups);
  24.     echo '<br />';
  25. }
  26.  
  27. // Remove
  28. $id array_rand($allGroups);
  29. $filters = array('group_id' => $allGroups[$id]['group_id']);
  30. $removed $admin->perm->removeGroup($filters);
  31.  
  32. if ($removed === false{
  33.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  34. else {
  35.     echo '<b>' $allGroups[$id]['group_id''</b> was deleted<br />';
  36.     unset($allGroups[$id]);
  37. }
  38.  
  39. // Update
  40. $id array_rand($allGroups);
  41. $filters = array('group_id' => $allGroups[$id]['group_id']);
  42. $data = array('group_define_name' => 'GROUP_' $allGroups[$id]['group_id''_UPDATED');
  43. $updated $admin->perm->updateGroup($data$filters);
  44.  
  45. if ($updated === false{
  46.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  47. else {
  48.     echo '<b>' $allGroups[$id]['group_id''</b> was updated<br />';
  49.     $params = array('filters' => array('group_id' => $allGroups[$id]['group_id']));
  50.     $group $admin->perm->getGroups($params);
  51.  
  52.     if ($group === false{
  53.         echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  54.     else {
  55.         Var_Dump::display($group);
  56.         echo '<br />';
  57.     }
  58. }
  59.  
  60. // Get
  61. echo 'All the groups:<br />';
  62.  
  63. $allGroups $admin->perm->getGroups();
  64. if ($allGroups === false{
  65.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  66. else {
  67.     Var_Dump::display($allGroups);
  68.     echo '<br />';
  69. }
  70. echo '<hr />';

Documentation generated on Mon, 11 Mar 2019 14:00:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.